﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Script.Data.Player
{
    public class PlayerData
    {
        public int Level { get; set; } = 1;
        /// <summary>
        /// 子弹信息
        /// </summary>
        public BulletData BulletData { get; set; } = new BulletData();
        /// <summary>
        /// 射击信息
        /// </summary>
        public AttackDir AttackDir { get; set; } = new AttackDir();

        public string WeaponName { get; set; } = "Umbrella";

        #region 护盾部分

        /// <summary>
        /// 护甲
        /// </summary>
        public BaseData Armor { get; set; } = new BaseData();

        /// <summary>
        /// 护盾
        /// </summary>
        public BaseData Shied { get; set; } = new BaseData();

        /// <summary>
        /// 护盾恢复速度
        /// <para>x秒/格</para>
        /// </summary>
        public BaseData ShiedRecTime { get; set; } = new BaseData();

        #endregion

        #region 人物
        /// <summary>
        /// 道具冷却缩减
        /// </summary>
        public BaseData PropCD { get; set; } = new BaseData();

        /// <summary>
        /// 攻击速度,一秒几次
        /// </summary>
        public BaseData AtkSpeed { get; set; } = new BaseData();
        /// <summary>
        /// 技能冷却缩减
        /// </summary>
        public BaseData SkillsCD { get; set; } = new BaseData(0);

        /// <summary>
        /// 血量
        /// </summary>
        public BaseData MaxHp { get; set; } = new BaseData();
        public BaseData MaxMana { get; set; } = new BaseData();

        /// <summary>
        /// 魔法值
        /// </summary>
        public BaseData Mp { get; set; } = new BaseData();

        /// <summary>
        /// 移动速度
        /// </summary>
        public BaseData WalkSpeed { get; set; } = new BaseData(0);

        /// <summary>
        /// 奔跑速度
        /// </summary>
        public BaseData RunSpeed { get; set; } = new BaseData(0);

        /// <summary>
        /// 翻滚间隔
        /// </summary>
        public BaseData RollInterval { get; set; } = new BaseData();

        /// <summary>
        /// 翻滚速度
        /// </summary>
        public BaseData RollSpeed { get; set; } = new BaseData();

        /// <summary>
        /// 受伤间隔,击退结束后的无敌消失时间
        /// </summary>
        public BaseData InjuredInterval { get; set; } = new BaseData();

        #endregion

        public PlayerData() { }

        public PlayerData(PlayerData data2)
        {
            BulletData = new BulletData(data2.BulletData);
            AttackDir = new AttackDir(data2.AttackDir);

            Armor = new BaseData(data2.Armor);
            PropCD = new BaseData(data2.PropCD);
            SkillsCD = new BaseData(data2.SkillsCD);
            Shied = new BaseData(data2.Shied);
            ShiedRecTime = new BaseData(data2.ShiedRecTime);

            AtkSpeed = new BaseData(data2.AtkSpeed);
            MaxHp = new BaseData(data2.MaxHp);
            MaxMana = new BaseData(data2.MaxMana);
            Mp = new BaseData(data2.Mp);
            RunSpeed = new BaseData(data2.RunSpeed);
            WalkSpeed = new BaseData(data2.WalkSpeed);
            RollInterval = new BaseData(data2.RollInterval);
            RollSpeed = new BaseData(data2.RollSpeed);
            InjuredInterval = new BaseData(data2.InjuredInterval);
        }

        public void Plus(PlayerData data2)
        {
            BulletData.Plus(data2.BulletData);
            AttackDir += data2.AttackDir;
            Armor += data2.Armor;
            PropCD += data2.PropCD;
            SkillsCD += data2.SkillsCD;
            Shied += data2.Shied;
            ShiedRecTime += data2.ShiedRecTime;

            AtkSpeed += data2.AtkSpeed;
            MaxHp += data2.MaxHp;
            MaxMana += data2.MaxMana;
            Mp += data2.Mp;
            RunSpeed += data2.RunSpeed;
            WalkSpeed += data2.WalkSpeed;
            RollInterval += data2.RollInterval;
            RollSpeed += data2.RollSpeed;
            InjuredInterval += data2.InjuredInterval;
        }

        public void Minus(PlayerData data2)
        {
            BulletData.Minus(data2.BulletData);
            AttackDir -= data2.AttackDir;
            Armor -= data2.Armor;
            PropCD -= data2.PropCD;
            SkillsCD -= data2.SkillsCD;
            Shied -= data2.Shied;
            ShiedRecTime -= data2.ShiedRecTime;

            AtkSpeed -= data2.AtkSpeed;
            MaxHp -= data2.MaxHp;
            MaxMana -= data2.MaxMana;
            Mp -= data2.Mp;
            RunSpeed -= data2.RunSpeed;
            WalkSpeed -= data2.WalkSpeed;
            RollInterval -= data2.RollInterval;
            RollSpeed -= data2.RollSpeed;
            InjuredInterval -= data2.InjuredInterval;
        }
    }
}
